package com.echoplots.json.entity;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
@JsonIgnoreProperties({ "password", "age" })  //3.@JsonIgnoreProperties，忽略一组属性
@JsonNaming(PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy.class)  //5.@JsonNaming，用于指定一个命名策略，作用于类或者属性上。Jackson自带了多种命名策略，你可以实现自己的命名策略，比如输出的key 由Java命名方式转为下面线命名方法 —— userName转化为user-name
public class User implements Serializable {
    private static final long serialVersionUID = 6222176558369919436L;
	private String userName;
	@JsonProperty("bth")	//1.@JsonProperty，作用在属性上，用来为JSON Key指定一个别名
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") //4.@JsonFormat，用于日期格式化
	private Date birthday;
    private int age;
    @JsonIgnore
    private String password;	//2.@JsonIgnore，作用在属性上，用来忽略此属性

	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
}
